<?php
namespace Admin\Model;
use Think\Model;

class ServiceAreaModel extends Model{
	/* 自动验证规则 */
    protected $_validate = array(
        array('areaname', 'require', '请填写名称', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('sort', 'require', '请填写排序', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('areaname', '', '该名称已存在', self::MUST_VALIDATE, 'unique', self::MODEL_BOTH),
    );

    /* 自动完成规则 */
    protected $_auto = array(
        array('areaname', 'htmlspecialchars', self::MODEL_BOTH, 'function'),
        array('sort', 'intval', self::MODEL_BOTH, 'function'),
        array('remark', 'htmlspecialchars', self::MODEL_BOTH, 'function'),
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME, self::MODEL_BOTH),
        array('status', 0, self::MODEL_INSERT),
    );
}